package com.maixun.lib_business_college.qa

import android.content.Context
import com.maixun.lib_business_college.R
import com.maixun.lib_business_college.entity.QABeen
import com.maixun.lib_comment.recyclerview.BaseAdapter
import com.maixun.lib_comment.recyclerview.ViewHolderImpl

/**
 * @author：Lmoumou
 * @date：2020/11/5
 */
class QAAdapter(context: Context, dataList: MutableList<QABeen>) :
    BaseAdapter<QABeen>(context, dataList) {
    override fun itemViewType(position: Int): Int {
        return R.layout.college_item_qa
    }

    override fun bindData(holder: ViewHolderImpl, position: Int) {
        dataList[position].run {
            holder.setText(R.id.tvTitle, title)
            holder.setText(R.id.tvLabel, typeName)
            holder.setText(R.id.tvContent, description)
            holder.setText(R.id.tvBrowse, "${readNum}人浏览")
            holder.setText(R.id.tvAnswerNum, "${answerNum}人回答")
            holder.setText(R.id.tvTime, getTimeStr() ?: "")
            null
        }
    }
}